import 'dart:convert';

import 'package:crypto/crypto.dart';
import 'package:flutter_massage/common_lib/utils/storage.dart';
import 'package:flutter_massage/values/index.dart';

class MessageUtils {
  static String get userKey => Storage().getString(StorageKey.userKey);

  static String createChatId(String technicianId) {
    var bytes = utf8.encode("$userKey$technicianId");

    var digest = md5.convert(bytes);

    return digest.toString();
  }

  static String createMessageId() {
    var bytes = utf8.encode(DateTime.now().millisecondsSinceEpoch.toString());

    var digest = md5.convert(bytes);

    return digest.toString();
  }
}
